const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('as4KDotsHolderBefore10', {
    id: {
      autoIncrement: true,
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true,
      comment: "编号"
    },
    stock_code: {
      type: DataTypes.STRING(10),
      allowNull: true,
      defaultValue: "",
      comment: "代码"
    },
    stock_name: {
      type: DataTypes.STRING(10),
      allowNull: true,
      defaultValue: "",
      comment: "名字"
    },
    holder_rank: {
      type: DataTypes.INTEGER,
      allowNull: true,
      comment: "排名"
    },
    holder_name: {
      type: DataTypes.STRING(128),
      allowNull: true,
      comment: "名字"
    },
    hold_num: {
      type: DataTypes.DECIMAL(50,2),
      allowNull: true,
      comment: "持仓数量"
    },
    hold_num_ratio: {
      type: DataTypes.DECIMAL(50,2),
      allowNull: true,
      comment: "持仓比例"
    },
    hold_change: {
      type: DataTypes.STRING(30),
      allowNull: true,
      comment: "增减持"
    },
    change_ratio: {
      type: DataTypes.DECIMAL(50,2),
      allowNull: true,
      comment: "变化率"
    },
    end_date: {
      type: DataTypes.STRING(20),
      allowNull: true,
      defaultValue: "",
      comment: "统计时间"
    },
    create_tie: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
      comment: "创建时间"
    },
    update_time: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
      comment: "更新时间"
    }
  }, {
    sequelize,
    tableName: 'as4k_dots_holder_before10',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
